#pragma once

#include <gtl/modules/IModule.h>
#include <gtl/thread/thread.h>
#include <gtl/io/find_file.h>
#include <gtl/smart_ptr/handler.h>

#include "IRename.h"
#include "RenameMessageHandler.h"

class CMRename : public CModuleImpl<IRename>
{
public:
	CMRename(void);
	virtual ~CMRename(void);

public:
	virtual void Rename(const RenameInfo& info, IRenameHandler* pHandler);
	virtual void Abort();

protected:
	unsigned long RenameThread();
	int FoundFile(const gtl::tchar* path, const _tfinddata_t& info);

protected:
	RenameInfo m_renameInfo;
	gtl::thread<> m_thread;
	CRenameMessageHandler m_handler;
};
